package com.dotflat.satistics.repository.crm.impl;

import com.dotflat.satistics.repository.crm.LeadsRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.Date;

/**
 * *******************************
 * Created by Ron.
 * form com.matt
 * on 2018/10/22
 * *******************************
 */
@Repository
public class LeadsRepositoryImpl implements LeadsRepository {

    @Autowired
    private JdbcTemplate crmJdbcTemplate;


    @Override
    public Long findCountByChannelAndCategory(Date begin, Date end, String areaId, String channelId, int category) {
        Long count = crmJdbcTemplate.queryForObject("select count(id) from leads where created >=? and created <=? and areaId =? and channel =? and category =?",new Object[]{begin,end,areaId,channelId,category},Long.class);
        return count;
    }
}
